﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EzDesk.Utility.Generic;
using Microsoft.Practices.Unity;

namespace EzDesk.Utility.Generic
{
    public abstract class ContainerAccessorBase : IContainerAccessor
    {
        protected IUnityContainer _appContainter = null;

        protected abstract IUnityContainer buildContainer();

        private static object lockObject = new object();

        public IUnityContainer Container
        {
            get
            {
                if (_appContainter == null)
                {
                    lock (lockObject)
                    {
                        if (_appContainter == null)
                        {
                            _appContainter = buildContainer();
                        }
                    }
                }
                return _appContainter;
            }
            set { _appContainter = value; }
        }

    }
}
